<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新浪网页两侧固定的广告</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }

        .box{
            width: 1002px;
            margin: 0 auto;
        }

        .ad-l,
        .ad-r{
            width: 120px;
            height: 288px;
        }

        .ad-l{
            position:fixed;
            top: 200px;
            left: 50%;
            /* 1002/2(版心的一半) + 120px(盒子自己的宽度) + 10px的缝隙 */
            margin-left: -631px;
        }

        .ad-r{
            position:fixed;
            top: 200px;
            right: 50%;
            margin-right: -631px;
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="images/box.png" alt="">
    </div>

    <!-- 左右固定定位 -->
    <div class="ad-l"><img src="images/ad-l.png" alt=""></div>
    <div class="ad-r"><img src="images/ad-r.png" alt=""></div>
</body>
</html>